#pragma once

typedef figureVertice Vertex;

class Node;
class Tree;

typedef std::vector<Node>   Neighbors;
typedef Neighbors::iterator NeighborsIterator;

//Now we have to set a map which will cover Vertex and position in vector
typedef std::map<Vertex, NeighborsIterator> VertexMap;

class Node
{
private:
  Vertex   _me;
  Node     *parent;
  Neighbors neighbors;
  int       waycost;
  int       visited; //-1 not yet , 0 - has a not visited children, 1 - all childrens are visited
public:
  void SetMe(const Vertex &)
  {
  }
  void SetParent(const Node &);
  void AddNeighbor(const Node &);
  void SetCost(int cost)
  {
  }
  bool operator == (const Vertex & v)
  {
    return (_me == v);
  };
};
//The shortest path is a path from destination to source
//by lowest cost, so it means if the one of the parent has 
//lower cost (in case more than one way to given node)
//it stays his parent


template<class T>
class BinaryGraph:
  public std::vector<T>
{
protected:

public:
  BinaryGraph(void);
  ~BinaryGraph(void);
  void AddNode(const Vertex &);
  void AddNeighbor(const Vertex &, const Vertex &);
protected:

};

typedef NeighborsIterator TreeIterator;

class Tree:
  public Neighbors
{
protected:
  TreeIterator m_nghIt;
public:
  void AddFirstElement(const Vertex &);
  void AddElement(const Vertex &, const Vertex &);

protected:
  TreeIterator & FindNode(const Vertex &);
};

